package ExtendDemo.demo11;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        ServerSocket ss=new ServerSocket(10003);
        Socket s = ss.accept();
        InputStream is = s.getInputStream();
        BufferedReader br=new BufferedReader(new InputStreamReader(is));
        String line;
        while ((line= br.readLine())!=null){
            System.out.println(line);
        }
        OutputStream os = s.getOutputStream();
        os.write("你谁啊？".getBytes(StandardCharsets.UTF_8));
        os.close();
        is.close();
        s.close();
        ss.close();
    }
}
